package com.mvc.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSONObject;
import com.mvc.domain.mongo.Human;
import com.mvc.service.HumanService;

/**
 * @author 李涛
 * @version 创建时间：2018年8月30日 下午3:09:04 类说明
 */
@RestController
@RequestMapping("/human")
public class HumanController {

	@Autowired
	private HumanService humanService;

	@RequestMapping("/index")
	public ModelAndView index() throws Exception {
		System.out.println("human/index！！");
		ModelAndView mav = new ModelAndView("human");
		List<Human> data = humanService.list(null);
		System.out.println(JSONObject.toJSONString(data));
		mav.addObject("data", data);
		return mav;
	}
}
